package xin.printk.android.module.login;

import xin.printk.android.BasicApplication;
import xin.printk.android.R;
import xin.printk.android.data.db.dao.UserDao;
import xin.printk.android.data.entity.User;
import xin.printk.android.utils.RequestCallback;

public class LoginModel {

    public void login(String account, String password, RequestCallback callback) {
        final User user = UserDao.login(account, password);
        if (user != null) {
            if (callback != null) {
                callback.onSuccess(user);
            }
        } else {
            if (callback != null) {
                callback.onFailure(BasicApplication.getContext().getString(R.string.login_error_tips));
            }
        }
    }
}
